# Contributor: Kaarle Ritvanen <kunkku@alpinelinux.org>
# Maintainer: Kaarle Ritvanen <kunkku@alpinelinux.org>
pkgname=py3-babel
_pkgname=Babel
pkgver=2.14.0
pkgrel=2
pkgdesc="Python3 i18n tool"
url="https://babel.pocoo.org/"
arch="noarch"
license="BSD-3-Clause"
depends="py3-tz py3-setuptools"
makedepends="py3-gpep517 py3-wheel"
checkdepends="py3-pytest py3-pytest-freezegun"
subpackages="$pkgname-pyc"
source="https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"
options="!check" # freezegun not in main

replaces="py-babel" # Backwards compatibility
provides="py-babel=$pkgver-r$pkgrel" # Backwards compatibility

# secfixes:
#   2.9.1-r0:
#     - CVE-2021-42771

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
cfcd93bc5e57e3d23b8fb67f77fdeeb08183cc5ef9a6e044085a090cec3d722cf658e740c639f5a834df11a4cff0dacafdbba435184d77a78d56fc0bb6b62fd2  Babel-2.14.0.tar.gz
"
